﻿using UnityEngine;

public enum BlockDirection : byte {
    Front,
    Back,
    Left,
    Right,
    Up,
    Bottom
}

public class Block {
    public byte id;
    public string name;
    public Texture icon;
    public BlockDirection direction = BlockDirection.Front;

    //front
    public byte textureFrontX, textureFrontY;
    //back
    public byte textureBackX, textureBackY;
    //left
    public byte textureLeftX, textureLeftY;
    //right
    public byte textureRightX, textureRightY;
    //up
    public byte textureUpX, textureUpY;
    //bottom
    public byte textureBottomX, textureBottomY;

    //所有面都是一样
    public Block (byte id, string name,
        byte textureX, byte textureY) : this (id, name,
        textureX, textureY,
        textureX, textureY,
        textureX, textureY,
        textureX, textureY) { }

    //顶面为A，其他一致
    public Block (byte id, string name,
        byte textureX, byte textureY,
        byte textureTopX, byte textureTopY) : this (id, name,
        textureX, textureY,
        textureX, textureY,
        textureX, textureY,
        textureX, textureY,
        textureTopX, textureTopY,
        textureX, textureY) { }

    //顶面为A,底面为B，其他一致
    public Block (byte id, string name,
        byte textureX, byte textureY,
        byte textureTopX, byte textureTopY,
        byte textureBottomX, byte textureBottomY) : this (id, name,
        textureX, textureY,
        textureX, textureY,
        textureX, textureY,
        textureX, textureY,
        textureTopX, textureTopY,
        textureBottomX, textureBottomY) { }

    //顶面为A，底面为B，前面为C，其余一致
    public Block (byte id, string name,
        byte textureX, byte textureY,
        byte textureTopX, byte textureTopY,
        byte textureBottomX, byte textureBottomY,
        byte textureFrontX, byte textureFrontY) : this (id, name,
        textureFrontX, textureFrontY,
        textureX, textureY,
        textureX, textureY,
        textureX, textureY,
        textureTopX, textureTopY,
        textureBottomX, textureBottomY) { }

    public Block (byte id, string name,
        byte textureFrontX, byte textureFrontY,
        byte textureBackX, byte textureBackY,
        byte textureLeftX, byte textureLeftY,
        byte textureRightX, byte textureRightY,
        byte textureUpX, byte textureUpY,
        byte textureBottomX, byte textureBottomY) {
        this.id = id;
        this.name = name;

        this.textureFrontX = textureFrontX;
        this.textureFrontY = textureFrontY;

        this.textureBackX = textureBackX;
        this.textureBackY = textureBackY;

        this.textureLeftX = textureLeftX;
        this.textureLeftY = textureLeftY;

        this.textureRightX = textureRightX;
        this.textureRightY = textureRightY;

        this.textureUpX = textureUpX;
        this.textureUpY = textureUpY;

        this.textureBottomX = textureBottomX;
        this.textureBottomY = textureBottomY;
    }
}